<?php

/**
 * calculation actions.
 *
 * @package    anchor
 * @subpackage calculation
 * @author     Your name here
 * @version    SVN: $Id: actions.class.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class calculationActions extends myActions
{
	/**
	 * Display list with calculation projects
	 * @param sfWebRequest $request
	 */
	public function executeIndex(sfWebRequest $request)
	{
    // Define acceptable filters
    $filters 							= array ();
    $filters["all"] 			= "allActiveCalculation";
    // Get filter value
    $filter = $request->getParameter('filter', null);
		// Check for needed filter
		if(is_null($filter) or !array_key_exists($filter, $filters))
			$this->redirect("@calculationfilter?module=calculation&action=index&filter=all&page=");
					
		// Display grid
		$this->pager = new sfDoctrinePager('project', sfConfig::get('app_project_list_count'));
		$this->pager->setTableMethod($filters[$filter]);				
		$this->pager->setPage($request->getParameter('page', 1));
		$this->pager->init();
	}
	/**
	 * Method to display calculation example
	 * @param sfWebRequest $request
	 */
	public function executeShow(sfWebRequest $request)
	{
		$this->project = Doctrine::getTable("project")->getCalculationExample($request->getParameter('id', null));
	}
	
	/**
	 * Method to display 
	 * @param sfWebRequest $request
	 */
	public function executeMethod(sfWebRequest $request)
	{
	
	}
}